package com.jin.lazytool.rewritte;

import com.jin.lazytool.entity.EventKeyConvertEntity;
import javafx.util.StringConverter;

import java.util.Map;

public class EventKeyConvert extends StringConverter<EventKeyConvertEntity> {

    private Map<String,EventKeyConvertEntity> map;

    public EventKeyConvert(Map<String,EventKeyConvertEntity> map){
       this.map = map;
    }

    @Override
    public String toString(EventKeyConvertEntity convert) {
        if(convert == null){
            System.out.println("-999-");
            return null;
        }
        return convert.getText();
    }

    @Override
    public EventKeyConvertEntity fromString(String s) {
        System.out.println(s+"--ss");
        return map.get(s);
    }
}
